package com.tekj.cxqcb.view.Module.adapter;

import android.support.annotation.Nullable;
import android.text.Html;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.squareup.picasso.Picasso;
import com.tekj.cxqcb.R;
import com.tekj.cxqcb.operation.resultBean.GetCarListBean;

import java.util.List;

import common.tool.Tools;


/**
 * 筛选后商品适配器
 */
public class ScreenGoodsadapter extends BaseQuickAdapter<GetCarListBean.DataBean.ListBean, BaseViewHolder> {

    public ScreenGoodsadapter(@Nullable List<GetCarListBean.DataBean.ListBean> data) {
        super(R.layout.item_screengoods, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GetCarListBean.DataBean.ListBean item) {

        Picasso.get().load(item.getImage()).resize(2048, 2048).into((ImageView) helper.getView(R.id.img_photo));
        helper.setText(R.id.tv_name, item.getTitle());

        helper.setGone(R.id.tv_labelOne, item.getLabelOne() != null || !"".equals(item.getLabelOne()));
        helper.setGone(R.id.tv_labelTwo, item.getLabelTwo() != null || !"".equals(item.getLabelTwo()));

        helper.setText(R.id.tv_labelOne, item.getLabelOne());
        helper.setText(R.id.tv_labelTwo, item.getLabelTwo());

        helper.setText(R.id.tv_platformPrice, "指导价" + Tools.ConvertedDigit(item.getFactoryPrice()) + "万");
        helper.setText(R.id.tv_price, Html.fromHtml("首付" + "<big>" + Tools.ConvertedDigit(item.getDownPay()) + "</big>" + "万"));
        helper.setText(R.id.tv_monthly_pay, "月供" + Tools.ConvertedDigit2(item.getMonPrice()) + "元");
    }
}
